package com.incom.log.server;

import com.incom.log.server.conf.ServiceConfig;
import com.incom.log.server.monitor.ServiceMonitor;
import com.incom.log.server.run.PrintLog;

import java.util.List;

public class StartMain {

    public static void main(String[] args) {
        //int config from file log-service.properties
        System.setProperty("LOG_PATH", "E:\\javaworkspace\\svncode\\iadp-log-appender");
        try {
            //读取配置信息
            ServiceConfig config = new ServiceConfig();
            //开启打印日志服务
            PrintLog printLog = new PrintLog();
            printLog.print(config);
            //监控模块启动，主要用于服务停止
            ServiceMonitor.loadMonitor(config.getProperties());
            List<ServiceMonitor> serviceMonitors = ServiceMonitor.getServiceMonitors();
            for (ServiceMonitor serviceMonitor : serviceMonitors) {
                serviceMonitor.initMonitor(config.getProperties());
                serviceMonitor.startMonitor();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
